package com.ykh.pojo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-11-13
 * Time: 11:54
 */
//统一返回结果
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result implements Serializable {
    private static final long serialVersionUID = 1L;
    private boolean success;

    private int code;

    private String msg;

    private Object data;

    public static Result success(Object data) {
        return new Result( true,200,"success",data);
    }

    public static Result success(String msg,Object data) {
        return new Result( true,200,msg,data);
    }


    public static  Result fail(int code, String msg) {
        return new Result(false,code,msg,null);
    }
}